<template>
  <view class="container">
    <view class="profile-header">
      <view class="user-info">
        <view class="avatar"></view>
        <view class="info">
          <view class="name">张三</view>
          <view class="bio">这是个人简介...</view>
        </view>
      </view>
      <view class="stats">
        <view class="stat-item">
          <text class="number">42</text>
          <text class="label">文章</text>
        </view>
        <view class="stat-item">
          <text class="number">128</text>
          <text class="label">关注</text>
        </view>
        <view class="stat-item">
          <text class="number">256</text>
          <text class="label">粉丝</text>
        </view>
      </view>
    </view>
    
    <view class="menu-list">
      <view class="menu-item" @tap="handleMenuClick('posts')">
        <text class="iconfont icon-article"></text>
        <text class="title">我的文章</text>
        <text class="iconfont icon-arrow-right"></text>
      </view>
      <view class="menu-item" @tap="handleMenuClick('likes')">
        <text class="iconfont icon-like"></text>
        <text class="title">我的点赞</text>
        <text class="iconfont icon-arrow-right"></text>
      </view>
      <view class="menu-item" @tap="handleMenuClick('comments')">
        <text class="iconfont icon-comment"></text>
        <text class="title">我的评论</text>
        <text class="iconfont icon-arrow-right"></text>
      </view>
      <view class="menu-item" @tap="handleMenuClick('settings')">
        <text class="iconfont icon-settings"></text>
        <text class="title">设置</text>
        <text class="iconfont icon-arrow-right"></text>
      </view>
    </view>
    
    <button class="btn outline logout-btn" @tap="handleLogout">退出登录</button>
  </view>
</template>

<script>
export default {
  data() {
    return {
      userInfo: {
        name: '张三',
        bio: '这是个人简介...',
        posts: 42,
        following: 128,
        followers: 256
      }
    }
  },
  methods: {
    handleMenuClick(type) {
      // TODO: 实现菜单跳转逻辑
      uni.showToast({
        title: '功能开发中',
        icon: 'none'
      })
    },
    handleLogout() {
      uni.showModal({
        title: '提示',
        content: '确定要退出登录吗？',
        success: (res) => {
          if (res.confirm) {
            // TODO: 实现退出登录逻辑
            uni.reLaunch({
              url: '/pages/login/login'
            })
          }
        }
      })
    }
  }
}
</script>

<style lang="scss">
@import '@/common/styles/common.scss';

.profile-header {
  width: 100%;
  box-sizing: border-box;
  background: #FFFFFF;
  padding: 48rpx 32rpx;
  margin-bottom: 24rpx;
  
  .user-info {
    display: flex;
    align-items: center;
    margin-bottom: 48rpx;
    
    .avatar {
      width: 120rpx;
      height: 120rpx;
      border-radius: 60rpx;
    }
    
    .info {
      margin-left: 24rpx;
      
      .name {
        font-size: 36rpx;
        font-weight: bold;
        margin-bottom: 8rpx;
      }
      
      .bio {
        font-size: 28rpx;
        color: $text-color-secondary;
      }
    }
  }
  
  .stats {
    display: flex;
    justify-content: space-around;
    
    .stat-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      
      .number {
        font-size: 36rpx;
        font-weight: bold;
        margin-bottom: 8rpx;
      }
      
      .label {
        font-size: 24rpx;
        color: $text-color-secondary;
      }
    }
  }
}

.menu-list {
  width: 100%;
  box-sizing: border-box;
  background: #FFFFFF;
  margin-bottom: 24rpx;
  
  .menu-item {
    display: flex;
    align-items: center;
    padding: 32rpx;
    border-bottom: 2rpx solid $border-color;
    
    &:last-child {
      border-bottom: none;
    }
    
    .iconfont {
      font-size: 40rpx;
      color: $text-color-secondary;
      
      &.icon-arrow-right {
        margin-left: auto;
      }
    }
    
    .title {
      font-size: 32rpx;
      margin-left: 24rpx;
    }
  }
}

.logout-btn {
  width: calc(100% - 64rpx);
  margin: 48rpx 32rpx;
  box-sizing: border-box;
}
</style> 